<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录</title>
    <link rel="shortcut icon" href="${ssy}/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="${ssy}/resources/css/font.css">
	<link rel="stylesheet" href="${ssy}/resources/css/weadmin.css">
    <script src="${ssy}/resources/layui/layui.js" charset="utf-8"></script>
</head>
<body class="login-bg">
      
    <div class="login">
        <div class="message">学生管理系统</div>
        <div id="darkbannerwrap"></div>
        
        <form method="post" class="layui-form" >
            <input name="loginName" placeholder="用户名"  lay-reqText="请输入用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input name="password" lay-verify="required"  lay-reqText="请输入密码" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <input name="checkCode" lay-verify="required"  lay-reqText="请输入验证码" placeholder="验证码" style="width:50%;display:inline-block;"  type="password" class="layui-input">
            <img id="checkCode" src="${ssy}/CheckCode.do" style="width:40%;float: right;height: 50px">
            <hr class="hr15">
            <input class="loginin" value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        </form>
    </div>

    <script type="text/javascript">
        layui.use(['form','jquery','layer'],function(){
        	var form = layui.form;
        	var $ = layui.jquery;
        	var layer = layui.layer;
        	
        	//切换验证码
        	$("#checkCode").click(function(){
        		$(this).attr("src","${ssy}/CheckCode.do?"+new Date());
        	});
        	//提交表单
        	form.on("submit(login)",function(d){
        		
        		$.post("${ssy}/user.do?type=login",d.field,function(rs){
        			if(rs.code != 200){
        				//显示错误信息
        				layer.msg(rs.msg);
        				return false;
        			}
        			//跳转到main.jsp
        			location.href = "${ssy}/page.do?type=toMain";
        		});
        		return false;
        	});
        	
        	
        });
        	
    </script>  
    <!-- 底部结束 -->

</body>
</html>